#pragma once
#include <cstdint>
#include <ctime>
#include <cstdlib>

namespace AutoScale
{
	class ConstantDuration
	{
	public:
		ConstantDuration(int32_t duration):
			duration_(duration)
		{
		}

		int32_t operator() () const
		{
			return duration_;
		}
	private:
		int32_t duration_;
	};

	class JitterDuration
	{
	public:
		JitterDuration(int32_t mean, int32_t jitterRange) :
			mean_(mean), jitterRange_(jitterRange)
		{
			srand(time(NULL));
		}

		int32_t operator() () const
		{
			return mean_ +  (rand() * 2 * jitterRange_/RAND_MAX) - jitterRange_;
		}
	private:
		int32_t mean_;
		int32_t jitterRange_;
	};
}